package org.example.leetcode;

/**
 * @version 1.0.0
 * @author: lynn
 * @description:
 * @date: 2021/7/24 20:49
 */
public class LC1736 {
    public static void main(String[] args) {
        LC1736 lc=new LC1736();
        System.out.println(lc.maximumTime("?0:15"));
    }

    public String maximumTime(String time) {
        char[] times=time.toCharArray();
        if (times[0]=='?') { // "?4:03"
            if (times[1]>'3' && times[1]!='?'){
                times[0]='1';
            } else {
                times[0]='2';
            }
        }

        if (times[1]=='?'){
            if (times[0]=='0' || times[0]=='1') times[1]='9';
            if (times[0]=='2') times[1]='3';
        }
        if (times[3]=='?') times[3]='5';
        if (times[4]=='?') times[4]='9';
        return String.valueOf(times);
    }
}
